<!DOCTYPE html>
<html lang="zh-Hans">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.3.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/blog/images/logo.svg" color="#222">

<link rel="stylesheet" href="/blog/css/main.css">

<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext">
<link rel="stylesheet" href="/blog/lib/font-awesome/css/font-awesome.min.css">


<script id="hexo-configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    hostname: new URL('https://guodh.gitee.io/blog').hostname,
    root: '/blog/',
    scheme: 'Pisces',
    version: '7.7.1',
    exturl: false,
    sidebar: {"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},
    copycode: {"enable":true,"show_result":true,"style":null},
    back2top: {"enable":true,"sidebar":false,"scrollpercent":false},
    bookmark: {"enable":false,"color":"#222","save":"auto"},
    fancybox: false,
    mediumzoom: false,
    lazyload: false,
    pangu: false,
    comments: {"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},
    algolia: {
      appID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    },
    localsearch: {"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},
    path: 'search.xml',
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}
  };
</script>

  <meta name="description" content="写下我的点点滴滴，写下我对这个世界的看法，还有我内心锁崇拜的技术">
<meta property="og:type" content="website">
<meta property="og:title" content="蛋蛋的小屋">
<meta property="og:url" content="https://guodh.gitee.io/blog/page/5/index.html">
<meta property="og:site_name" content="蛋蛋的小屋">
<meta property="og:description" content="写下我的点点滴滴，写下我对这个世界的看法，还有我内心锁崇拜的技术">
<meta property="og:locale">
<meta property="article:author" content="RunningEgg">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="https://guodh.gitee.io/blog/page/5/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome: true,
    isPost: false
  };
</script>

  <title>蛋蛋的小屋</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-meta">

    <div>
      <a href="/blog/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">蛋蛋的小屋</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
        <p class="site-subtitle">来了就看看吧，没有刀剑只有故事</p>
  </div>

  <div class="site-nav-toggle">
    <div class="toggle" aria-label="Toggle navigation bar">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/blog/" rel="section"><i class="fa fa-fw fa-home"></i>Home</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/blog/about/" rel="section"><i class="fa fa-fw fa-user"></i>About</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/blog/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>Archives</a>

  </li>
        <li class="menu-item menu-item-book">

    <a href="/blog/book/" rel="section"><i class="fa fa-fw fa-archive"></i>book</a>

  </li>
  </ul>

</nav>
</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content">
            

  <div class="posts-expand">
        
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block home" lang="zh-Hans">
    <link itemprop="mainEntityOfPage" href="https://guodh.gitee.io/blog/2018/12/29/2018/%E5%88%86%E5%B8%83%E5%BC%8F%E7%B3%BB%E7%BB%9Fvs%E9%9B%86%E7%BE%A4%E7%B3%BB%E7%BB%9F/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/blog/images/avatar.gif">
      <meta itemprop="name" content="RunningEgg">
      <meta itemprop="description" content="写下我的点点滴滴，写下我对这个世界的看法，还有我内心锁崇拜的技术">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="蛋蛋的小屋">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          
            <a href="/blog/2018/12/29/2018/%E5%88%86%E5%B8%83%E5%BC%8F%E7%B3%BB%E7%BB%9Fvs%E9%9B%86%E7%BE%A4%E7%B3%BB%E7%BB%9F/" class="post-title-link" itemprop="url">分布式系统vs集群系统</a>
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>

              <time title="Created: 2018-12-29 17:48:21" itemprop="dateCreated datePublished" datetime="2018-12-29T17:48:21+08:00">2018-12-29</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">Edited on</span>
                <time title="Modified: 2019-01-20 21:01:32" itemprop="dateModified" datetime="2019-01-20T21:01:32+08:00">2019-01-20</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p>以前都会纠结一个问题，什么是分布式系统？什么是集群？服务器数量变多是不是就是从集群演化为分布式？</p>
<p>举一些例子，</p>
<ol>
<li>mysql主从系统</li>
<li>mysql分库分表 + 主从系统</li>
<li>Nginx + 多台服务器构建的 Spring MVC 系统</li>
<li>dubbo的服务化系统</li>
<li>Rocketmq 双Master</li>
</ol>
<p>在举一些被认为是分布式系统的例子，</p>
<ol>
<li>Hbase</li>
<li>kafka</li>
<li>Elasticsearch</li>
<li>TIDB</li>
</ol>
          <!--noindex-->
            <div class="post-button">
              <a class="btn" href="/blog/2018/12/29/2018/%E5%88%86%E5%B8%83%E5%BC%8F%E7%B3%BB%E7%BB%9Fvs%E9%9B%86%E7%BE%A4%E7%B3%BB%E7%BB%9F/#more" rel="contents">
                Read more &raquo;
              </a>
            </div>
          <!--/noindex-->
        
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

        
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block home" lang="zh-Hans">
    <link itemprop="mainEntityOfPage" href="https://guodh.gitee.io/blog/2018/12/22/2018/%E6%8D%A2%E4%B8%AA%E8%A7%92%E5%BA%A6%E7%9C%8BJava%E7%9A%84Thread/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/blog/images/avatar.gif">
      <meta itemprop="name" content="RunningEgg">
      <meta itemprop="description" content="写下我的点点滴滴，写下我对这个世界的看法，还有我内心锁崇拜的技术">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="蛋蛋的小屋">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          
            <a href="/blog/2018/12/22/2018/%E6%8D%A2%E4%B8%AA%E8%A7%92%E5%BA%A6%E7%9C%8BJava%E7%9A%84Thread/" class="post-title-link" itemprop="url">换个角度看Java的Thread</a>
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>

              <time title="Created: 2018-12-22 17:18:18" itemprop="dateCreated datePublished" datetime="2018-12-22T17:18:18+08:00">2018-12-22</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">Edited on</span>
                <time title="Modified: 2019-01-05 12:07:25" itemprop="dateModified" datetime="2019-01-05T12:07:25+08:00">2019-01-05</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p>在Java的世界中，新开一个线程很容易，你只需要用下面的代码。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">Thread thread = <span class="keyword">new</span> Thread(() -&gt; &#123;<span class="keyword">while</span>(<span class="keyword">true</span>) &#123;doSomeThing...&#125;&#125;);</span><br><span class="line">thread.run();</span><br></pre></td></tr></table></figure>
<p>在深入一点，你应该知道Thread.run()调用了Linux的fork()函数，从父线程中copy出一个一摸一样的子线程，然后开出了一个新的线程。</p>
<p>但是呢？在深入思考一下，提一个问题：</p>
<blockquote>
<p>为啥说Go可以随意Goroutine几百几万个？而Java确不建议开那么多的线程，都是建议使用线程池来处理问题？或者说代码里面随意的使用new Thread()可以吗？</p>
</blockquote>
<p>答案就是: Go提供的线程是协程是语言层面的，线程切换不必牵涉CPU上下文切换（而且还提供了Forkjoin机制，当有单个协程阻塞，可以分配），Java的线程使用的是Linux的fork()，会涉及CPU上下文切换。</p>
          <!--noindex-->
            <div class="post-button">
              <a class="btn" href="/blog/2018/12/22/2018/%E6%8D%A2%E4%B8%AA%E8%A7%92%E5%BA%A6%E7%9C%8BJava%E7%9A%84Thread/#more" rel="contents">
                Read more &raquo;
              </a>
            </div>
          <!--/noindex-->
        
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

        
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block home" lang="zh-Hans">
    <link itemprop="mainEntityOfPage" href="https://guodh.gitee.io/blog/2018/12/01/2018/%E9%87%8D%E6%96%B0%E8%AE%A4%E8%AF%86%E6%97%A5%E5%BF%97%E7%B3%BB%E7%BB%9F/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/blog/images/avatar.gif">
      <meta itemprop="name" content="RunningEgg">
      <meta itemprop="description" content="写下我的点点滴滴，写下我对这个世界的看法，还有我内心锁崇拜的技术">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="蛋蛋的小屋">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          
            <a href="/blog/2018/12/01/2018/%E9%87%8D%E6%96%B0%E8%AE%A4%E8%AF%86%E6%97%A5%E5%BF%97%E7%B3%BB%E7%BB%9F/" class="post-title-link" itemprop="url">重新认识日志系统</a>
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>

              <time title="Created: 2018-12-01 12:40:11" itemprop="dateCreated datePublished" datetime="2018-12-01T12:40:11+08:00">2018-12-01</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">Edited on</span>
                <time title="Modified: 2018-12-02 11:08:03" itemprop="dateModified" datetime="2018-12-02T11:08:03+08:00">2018-12-02</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p>近期，考虑到Job系统需要打很多的日志（调用别人的API真的是坑呀，一不留神别人就把你限流了，还是别人内部服务器的问题，所以还是要多打印些日志）。笔者想优化下日志系统，然后成功又把自己拐坑里了。不过也是因为自己对于日志系统不够充分了解，借此机会更好的了解日志系统。</p>
<p>优化的手段比较简单：</p>
<ol>
<li>生产环境去除打印控制台日志</li>
<li>将RollingFile改为RollingRandomAccessFile</li>
<li>添加Disruptor的Jar，开启Log4j2的异步化</li>
</ol>
<p>ps：优化2是借用RollingRandomAccessFile中的buffer来提升IO效率，在开启Log4j2的异步化之后，笔者选择将RollingRandomAccessFile改回RollingFile。另外，异步化也不是十全十美的，在停止服务的时候会损失一部分日志的。如果能在停止服务的时候Sleep一段时间那是最好的，本项目对于一部分日志不在意所以也就没加Sleep。</p>
          <!--noindex-->
            <div class="post-button">
              <a class="btn" href="/blog/2018/12/01/2018/%E9%87%8D%E6%96%B0%E8%AE%A4%E8%AF%86%E6%97%A5%E5%BF%97%E7%B3%BB%E7%BB%9F/#more" rel="contents">
                Read more &raquo;
              </a>
            </div>
          <!--/noindex-->
        
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

        
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block home" lang="zh-Hans">
    <link itemprop="mainEntityOfPage" href="https://guodh.gitee.io/blog/2018/11/17/2018/Hbase%E4%BB%8E%E5%85%A5%E9%97%A8%E5%88%B0%E5%AE%9E%E8%B7%B5/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/blog/images/avatar.gif">
      <meta itemprop="name" content="RunningEgg">
      <meta itemprop="description" content="写下我的点点滴滴，写下我对这个世界的看法，还有我内心锁崇拜的技术">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="蛋蛋的小屋">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          
            <a href="/blog/2018/11/17/2018/Hbase%E4%BB%8E%E5%85%A5%E9%97%A8%E5%88%B0%E5%AE%9E%E8%B7%B5/" class="post-title-link" itemprop="url">Hbase从入门到实践</a>
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>

              <time title="Created: 2018-11-17 12:53:01" itemprop="dateCreated datePublished" datetime="2018-11-17T12:53:01+08:00">2018-11-17</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">Edited on</span>
                <time title="Modified: 2018-11-24 15:33:27" itemprop="dateModified" datetime="2018-11-24T15:33:27+08:00">2018-11-24</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p>很久以前就看到过关于Hbase的相关信息，那时以为这种需要大数据相关知识的数据库肯定是我这种业务开发程序员所接触不到的。<br>但是随着经历的公司多了，发现其实对于大数据这个概念而言，其实不过是Java开发的一个分支。你可以看到在很多的ToB业务中，都需要用到Hive，HBase，Spark等等这类常见的Hadoop系列的大数据操作工具。相对与ToC的业务，ToB需要看到数据的变化，越多的数据对于客户具有越高的价值。<br>例如，最近跑Demo的一个用户的店，广告系统就有60W的关键词信息，而且产品还要求每两个小时给用户跑一次。所以对于一般的程序员，大数据相关也是需要知道相关知识的。</p>
<p>有点扯远了，回到Hbase这个话题，这次通过这个项目对于Hbase有了一个完整的理解，所以一起来分析给大家。</p>
          <!--noindex-->
            <div class="post-button">
              <a class="btn" href="/blog/2018/11/17/2018/Hbase%E4%BB%8E%E5%85%A5%E9%97%A8%E5%88%B0%E5%AE%9E%E8%B7%B5/#more" rel="contents">
                Read more &raquo;
              </a>
            </div>
          <!--/noindex-->
        
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

        
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block home" lang="zh-Hans">
    <link itemprop="mainEntityOfPage" href="https://guodh.gitee.io/blog/2018/11/14/2018/%E5%A6%82%E4%BD%95%E7%9B%91%E7%AE%A1%E5%A4%9A%E7%BA%BF%E7%A8%8B/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/blog/images/avatar.gif">
      <meta itemprop="name" content="RunningEgg">
      <meta itemprop="description" content="写下我的点点滴滴，写下我对这个世界的看法，还有我内心锁崇拜的技术">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="蛋蛋的小屋">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          
            <a href="/blog/2018/11/14/2018/%E5%A6%82%E4%BD%95%E7%9B%91%E7%AE%A1%E5%A4%9A%E7%BA%BF%E7%A8%8B/" class="post-title-link" itemprop="url">如何监管多线程</a>
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>

              <time title="Created: 2018-11-14 13:45:21" itemprop="dateCreated datePublished" datetime="2018-11-14T13:45:21+08:00">2018-11-14</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">Edited on</span>
                <time title="Modified: 2018-11-24 15:32:18" itemprop="dateModified" datetime="2018-11-24T15:32:18+08:00">2018-11-24</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p>都知道大型的软件项目中存在大量的线程，例如典型的是我正在做的一个data项目。简单的来讲data就是负责通过API拉取Amazon以及各平台报告的一个系统。为了能够提升速度，data项目部署了一个web服务，5个Job服务，使用了XXL-job对Job进行调度管理。同时每一次Job接收到XXL-job的调度都会开启多个线程同时进行数据报告的拉取。</p>
<p>希望有一个方式能够低影响的管理这些任务，类似一个控制平台的概念。Rocketmq的控制台。</p>
          <!--noindex-->
            <div class="post-button">
              <a class="btn" href="/blog/2018/11/14/2018/%E5%A6%82%E4%BD%95%E7%9B%91%E7%AE%A1%E5%A4%9A%E7%BA%BF%E7%A8%8B/#more" rel="contents">
                Read more &raquo;
              </a>
            </div>
          <!--/noindex-->
        
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

        
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block home" lang="zh-Hans">
    <link itemprop="mainEntityOfPage" href="https://guodh.gitee.io/blog/2018/11/01/2018/Mysql%E5%BC%95%E6%93%8EInnodb/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/blog/images/avatar.gif">
      <meta itemprop="name" content="RunningEgg">
      <meta itemprop="description" content="写下我的点点滴滴，写下我对这个世界的看法，还有我内心锁崇拜的技术">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="蛋蛋的小屋">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          
            <a href="/blog/2018/11/01/2018/Mysql%E5%BC%95%E6%93%8EInnodb/" class="post-title-link" itemprop="url">Mysql引擎Innodb</a>
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>

              <time title="Created: 2018-11-01 20:39:17" itemprop="dateCreated datePublished" datetime="2018-11-01T20:39:17+08:00">2018-11-01</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">Edited on</span>
                <time title="Modified: 2018-11-17 16:51:50" itemprop="dateModified" datetime="2018-11-17T16:51:50+08:00">2018-11-17</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p>Innodb引擎，是Mysql能够在如今这个分布式时代依旧闪亮在舞台上的重要原因。即使闪亮如Postgresql的数据库，依旧还是没Mysql流行。但是，如果抓住一个服务端开发，问他</p>
<ul>
<li>Mysql的架构是什么样的？Mysql如何兼容不同引擎？</li>
<li>数据库的物理数据是由Mysql管理还是引擎管理？</li>
<li>跑SQL的时候选择哪个索引是由Innodb决定还是有Mysql决定？</li>
</ul>
<p>很多coder可能都回答不上来。这么造成什么样的结果，万一有一天需要升级Innodb，对于开发根本不知道哪些优化了哪些并没有提升。</p>
          <!--noindex-->
            <div class="post-button">
              <a class="btn" href="/blog/2018/11/01/2018/Mysql%E5%BC%95%E6%93%8EInnodb/#more" rel="contents">
                Read more &raquo;
              </a>
            </div>
          <!--/noindex-->
        
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

        
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block home" lang="zh-Hans">
    <link itemprop="mainEntityOfPage" href="https://guodh.gitee.io/blog/2018/10/23/2018/Lua%E8%AF%AD%E8%A8%80%E5%88%9D%E6%8E%A2/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/blog/images/avatar.gif">
      <meta itemprop="name" content="RunningEgg">
      <meta itemprop="description" content="写下我的点点滴滴，写下我对这个世界的看法，还有我内心锁崇拜的技术">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="蛋蛋的小屋">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          
            <a href="/blog/2018/10/23/2018/Lua%E8%AF%AD%E8%A8%80%E5%88%9D%E6%8E%A2/" class="post-title-link" itemprop="url">Lua语言初探</a>
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>

              <time title="Created: 2018-10-23 20:22:45" itemprop="dateCreated datePublished" datetime="2018-10-23T20:22:45+08:00">2018-10-23</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">Edited on</span>
                <time title="Modified: 2018-10-29 09:30:13" itemprop="dateModified" datetime="2018-10-29T09:30:13+08:00">2018-10-29</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p>第一次知道Lua是在抢红包这种业务场景中。原来以为都是靠随机来生成红包的，结果是优先按照红包数量分配好红包金额，按照用户进来的顺序拿就就行。当然很多情况需要使用到Redis，同时为了网络的低延迟以及原子性，会在代码中嵌入Lua语言。</p>
<blockquote>
<p>Lua 是一种轻量小巧的脚本语言，用标准C语言编写并以源代码形式开放，其设计目的是为了嵌入应用程序中，从而为应用程序提供灵活的扩展和定制功能。</p>
</blockquote>
<p>而Lua作为一种胶水语言，很有意思，在一些特定的场合会发挥出很强大的作用。例如，今天要看到的OpenResty，就是典型的Nginx + Lua的组合。</p>
          <!--noindex-->
            <div class="post-button">
              <a class="btn" href="/blog/2018/10/23/2018/Lua%E8%AF%AD%E8%A8%80%E5%88%9D%E6%8E%A2/#more" rel="contents">
                Read more &raquo;
              </a>
            </div>
          <!--/noindex-->
        
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

        
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block home" lang="zh-Hans">
    <link itemprop="mainEntityOfPage" href="https://guodh.gitee.io/blog/2018/10/20/2018/%E5%88%86%E5%B8%83%E5%BC%8F%E4%BA%8B%E5%8A%A1/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/blog/images/avatar.gif">
      <meta itemprop="name" content="RunningEgg">
      <meta itemprop="description" content="写下我的点点滴滴，写下我对这个世界的看法，还有我内心锁崇拜的技术">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="蛋蛋的小屋">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          
            <a href="/blog/2018/10/20/2018/%E5%88%86%E5%B8%83%E5%BC%8F%E4%BA%8B%E5%8A%A1/" class="post-title-link" itemprop="url">分布式事务</a>
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>

              <time title="Created: 2018-10-20 09:25:56" itemprop="dateCreated datePublished" datetime="2018-10-20T09:25:56+08:00">2018-10-20</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">Edited on</span>
                <time title="Modified: 2018-10-28 20:59:18" itemprop="dateModified" datetime="2018-10-28T20:59:18+08:00">2018-10-28</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p>分布式事务应该是大家耳熟能详的东西了吧。作为一个当今时代”微服务蓬勃发展”背景下的程序员，如果出去面试被问到分布式事务还不能哔哔几句的话，估计是要凉凉的节奏。对于分布式事务，大家比较了解的2PC，3PC，以及最终一致性，当然也包括Saga的补偿模式。关于Sage大家可以看 </p>
<blockquote>
<p><a href="https://servicecomb.incubator.apache.org/cn/docs/distributed-transactions-saga-implementation/">https://servicecomb.incubator.apache.org/cn/docs/distributed-transactions-saga-implementation/</a> </p>
</blockquote>
<p>由Servicecomb提供的实现，毕竟是Apache项目稳定性有保证。</p>
<p>当把我们的目光放回来，虽说我们都知道分布式事务有这几种模式，但是只见过猪肉没见过猪跑呀。还好随着国内开源环境的逐渐变好，有很多厉害的人为我们实现了这些规范。让我们这些萌新，即使不要去到大厂一样也能看到猪跑。那么文本的目的就是查看源码，看看他们到底是如何“实现”分布式事务的。注意是实现，我们不关注细节，但是要明确他们是如何将我们需周知的概念转化为可实现的代码。</p>
          <!--noindex-->
            <div class="post-button">
              <a class="btn" href="/blog/2018/10/20/2018/%E5%88%86%E5%B8%83%E5%BC%8F%E4%BA%8B%E5%8A%A1/#more" rel="contents">
                Read more &raquo;
              </a>
            </div>
          <!--/noindex-->
        
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

        
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block home" lang="zh-Hans">
    <link itemprop="mainEntityOfPage" href="https://guodh.gitee.io/blog/2018/10/10/2018/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/blog/images/avatar.gif">
      <meta itemprop="name" content="RunningEgg">
      <meta itemprop="description" content="写下我的点点滴滴，写下我对这个世界的看法，还有我内心锁崇拜的技术">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="蛋蛋的小屋">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          
            <a href="/blog/2018/10/10/2018/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/" class="post-title-link" itemprop="url">设计模式</a>
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>

              <time title="Created: 2018-10-10 19:05:54" itemprop="dateCreated datePublished" datetime="2018-10-10T19:05:54+08:00">2018-10-10</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">Edited on</span>
                <time title="Modified: 2018-10-22 11:39:29" itemprop="dateModified" datetime="2018-10-22T11:39:29+08:00">2018-10-22</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h2 id="为什么需要设计模式"><a href="#为什么需要设计模式" class="headerlink" title="为什么需要设计模式"></a>为什么需要设计模式</h2><p>原来只是单纯的听别人的理解，而没有自己很好的体会和领悟。借着这次设计支付网关的机会，重新对设计模式有了新的体会。对于我而言，设计模式能够保证在下一次改造中，你只需要添加功能，而完全不需要影响其他功能。最明显的好处就是，测试就不用在测一遍上次的测试内容了。</p>
<p>就像在我的这次设计支付网关的过程中，简单的使用了工厂模式。完全的隔离了各个不同支付渠道的细节，上层只需要关注 pay()，query()，refund()提供的能力，完全不必关注是支付宝还是微信。当我需要添加一个支付渠道的时候，仅仅需要重新添加一个支付渠道，而完全不需要需改支付的业务逻辑。这很大的提升了业务的灵活性。</p>
<p>设计模式很神奇，他并不是为了让你的代码简洁，也并不是为了让你出更少的bug。只是保证了，“每一次代码的变动都不会影响以前的代码而已”。但是，正因为这一点，越少的改动就越能够保证更少的bug产生。    </p>
          <!--noindex-->
            <div class="post-button">
              <a class="btn" href="/blog/2018/10/10/2018/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/#more" rel="contents">
                Read more &raquo;
              </a>
            </div>
          <!--/noindex-->
        
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

        
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block home" lang="zh-Hans">
    <link itemprop="mainEntityOfPage" href="https://guodh.gitee.io/blog/2018/10/08/2018/Tomcat%E6%9E%B6%E6%9E%84/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/blog/images/avatar.gif">
      <meta itemprop="name" content="RunningEgg">
      <meta itemprop="description" content="写下我的点点滴滴，写下我对这个世界的看法，还有我内心锁崇拜的技术">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="蛋蛋的小屋">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          
            <a href="/blog/2018/10/08/2018/Tomcat%E6%9E%B6%E6%9E%84/" class="post-title-link" itemprop="url">Tomcat架构</a>
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>

              <time title="Created: 2018-10-08 14:40:06" itemprop="dateCreated datePublished" datetime="2018-10-08T14:40:06+08:00">2018-10-08</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">Edited on</span>
                <time title="Modified: 2018-12-22 17:24:32" itemprop="dateModified" datetime="2018-12-22T17:24:32+08:00">2018-12-22</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p>在新公司技术团队比较薄弱，很多运维方面的东西都需要自己搞。业务团队必须去理解业务代码所处于的容器，无论是Tomcat，jetty，还是Undertow。</p>
<p>罗列一些我认为需要去了解容器的点：</p>
<ul>
<li>线程池配置</li>
<li>内部架构</li>
<li>JVM配置</li>
</ul>
<h2 id="Tomcat-架构"><a href="#Tomcat-架构" class="headerlink" title="Tomcat 架构"></a>Tomcat 架构</h2>
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

  </div>

  
  <nav class="pagination">
    <a class="extend prev" rel="prev" href="/blog/page/4/"><i class="fa fa-angle-left" aria-label="Previous page"></i></a><a class="page-number" href="/blog/">1</a><span class="space">&hellip;</span><a class="page-number" href="/blog/page/4/">4</a><span class="page-number current">5</span><a class="page-number" href="/blog/page/6/">6</a><span class="space">&hellip;</span><a class="page-number" href="/blog/page/9/">9</a><a class="extend next" rel="next" href="/blog/page/6/"><i class="fa fa-angle-right" aria-label="Next page"></i></a>
  </nav>



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let activeClass = CONFIG.comments.activeClass;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          Table of Contents
        </li>
        <li class="sidebar-nav-overview">
          Overview
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">RunningEgg</p>
  <div class="site-description" itemprop="description">写下我的点点滴滴，写下我对这个世界的看法，还有我内心锁崇拜的技术</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/blog/archives/">
        
          <span class="site-state-item-count">89</span>
          <span class="site-state-item-name">posts</span>
        </a>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">24</span>
        <span class="site-state-item-name">tags</span>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="mailto:guodh_1@163.com" title="E-Mail → mailto:guodh_1@163.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
      </span>
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">RunningEgg</span>
</div>
  <div class="powered-by">Powered by <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> v5.3.0
  </div>
  <span class="post-meta-divider">|</span>
  <div class="theme-info">Theme – <a href="https://pisces.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> v7.7.1
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/blog/lib/anime.min.js"></script>
  <script src="/blog/lib/velocity/velocity.min.js"></script>
  <script src="/blog/lib/velocity/velocity.ui.min.js"></script>

<script src="/blog/js/utils.js"></script>

<script src="/blog/js/motion.js"></script>


<script src="/blog/js/schemes/pisces.js"></script>


<script src="/blog/js/next-boot.js"></script>




  















  

  

</body>
</html>
